require(["common", "coAjax", "href", "eventManager", "hash_routie"], function(jSouper, coAjax, href, eventManager, hash_routie) {
	App.set("$Event.user_login_out", function() {
		coAjax.get(appConfig.user.login_out_url, function() {
			App.set("loginer", null);
			if (_isWX) {
				globalSet("WEIXIN_OPENID:" + appConfig.bus_id, "", function() {
					location.href = "mobile.main.html#default/main";
				});
			}
		});
	});
	App.set("$Event.jumpToLogin", function() {
		myConfirm("您还未登陆，请先登陆", function() {
			location.href = "#default/sign_in";
		});
	});
	App.set("$Event.show_location_store_share", function() {
		App.model.toggle("$Cache.show_location_store_share");
	});
	hash_routie.on("user", function() {
		App.set("thisPage", 4);
		document.body.scrollTop = 0;
		//微信绑定
		globalGet("WEIXIN_OPENID:" + appConfig.bus_id, function(openid) {
			App.set("$Cache.WX.openid", openid);
			App.set("$Event.personal.main.bind_weixin_by_openid", function() {
				coAjax.put(appConfig.user.bind_weixin_account_by_open_id, {
					openid: openid
				}, function(result) {
					App.set("loginer", result.result);
					alert("success", "微信号绑定成功，下次无需手动登录");
				});
			});
		});
	});

})